<%@page import="com.zhufei.entity.ZFAdministrator"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>管理员列表</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<style type="text/css">
<!--
body,td,th {
	font-size: 13px;
}
-->
</style>
			<%
	ZFAdministrator adminCheck = (ZFAdministrator)session.getAttribute("admin");
	if(adminCheck.getClass_() == 2){ %>
	<script  language="javascript">
		function a(){
		alert("对不起，您的权限不够！");		
}
	document.onLoad = a();
	</script>
	<%
		response.sendRedirect("adminIndex.jsp");
	}
 %>
	</head>

	<body>

		<table width="99%" border="5" align="center" cellpadding="5"
			cellspacing="5" bordercolor="#CCCCCC" bgcolor="#FFFFFF">
			<tr>
				<td height="16" background="admin/images/topbg.gif"
					bgcolor="#F7F7F7">
				<span class="STYLE1"> <img src="admin/images/pic5.gif"
							width="28" height="22" />您现在所在的位置是： <a
						href="admin/adminIndex.jsp">管理首页</a> -&gt;<strong><font
							color="red">管理员列表</font> </strong> </span></td>
                            
                    <td align="right" background="admin/images/topbg.gif"
					bgcolor="#F7F7F7"><a href="admin/addAdmin.jsp" target="shopv4">添加管理员</a></td>
			</tr>
			<tr>
				<td colspan="2" bgcolor="#FFFFFF">
			    <form action="" method="post" enctype="multipart/form-data"
						name="form1">
						<br>

					<table width="78%" height="56" border="2" align="center" cellpadding="1"
							cellspacing="1" bordercolor="#FFFFFF" bgcolor="#CCCCCC">
						<tr align="center" bgcolor="#F7F7F7" height="20">
							<td width="10%" height="25" background="images/topbg.gif"> 管理员序号</td>
								<td width="16%" background="images/topbg.gif">管理员</td>
							<td width="21%" background="images/topbg.gif">管理员密码</td>
							<td width="14%" background="images/topbg.gif">管理员所属区域</td>
							<td width="18%" background="images/topbg.gif">管理员类别</td>
							<td width="21%" background="images/topbg.gif">
								操作
							</td>
					    </tr>
					    <%
					    	ArrayList<ZFAdministrator> adminList = (ArrayList<ZFAdministrator>)session.getAttribute("adminList");
					    	int pageRecord = (Integer)session.getAttribute("page_record");
					    	int curPages =(Integer)session.getAttribute("current_page");
					    	int totalPages = (Integer)session.getAttribute("total_page");

					    	for(int i = (curPages-1) * 10,j = 0 ; i < adminList.size() && j < pageRecord ; i++,j++){
					    	ZFAdministrator admin  = adminList.get(i);
					     %>
						<tr align="center" bgcolor="#F7F7F7" height="20">
							<td height="25" background="images/topbg.gif"><%=i+1%></td>
							<td height="25" background="images/topbg.gif"><%=admin.getAdministrator_name()%></td>
							<td background="images/topbg.gif"><%=admin.getPassword()%></td>
							<td background="images/topbg.gif"><%=admin.getRegion() %></td>
							<td background="images/topbg.gif">
							<%
								if(admin.getClass_() == 1){
							 %>总部管理员
							 <%}if(admin.getClass_() == 2) {%>
							 	一级管理员
							 	<%} %>
							 </td>
							<td background="images/topbg.gif">
							  <a href="adminServlet?action=delete&id=<%=admin.getID()%>">删除</a>						    </td>
						</tr>
						<%
								}
						%>
				    </table>
				  </form>

	<table width="85%" border="2" align="center" cellspacing="0"
						bordercolor="#FFFFFF" bgcolor="#CCCCCC">
						<tr bgcolor="#F7F7F7">
							<td width="632" background="images/topbg.gif">
								<p align="center">
									<a href="adminServlet?action=manage">首页</a>
									<%
										if (curPages > 1) {
									%>
									
									<a href="adminServlet?action=manage&&page=<%=curPages - 1%>">上一页</a>
									<%
										}
									%>
									<%
										if (curPages < totalPages) {
									%>
									
									<a href="adminServlet?action=manage&&page=<%=curPages + 1%>">下一页</a>
									<%
										}
									%>
									<a href="adminServlet?action=manage&&page=<%=totalPages%>">尾页</a>
									
									共<%=totalPages%>页
								</p>
							</td>
						</tr>
					</table>
					<br>
				</td>
			</tr>
		</table>
		<br>
		<br>

	</body>
</html>
